#include <iostream>
#include "unorderedmap.h"
#include "unorderedset.h"
using namespace std;

void test1()
{
	txp::unordered_map<int, int> m1;
	m1.insert({ 1,1 });
	m1.insert({ 2,2 });
	m1.insert({ 3,3 });
	m1.insert({ 4,4 });
	m1.insert({ 5,5 });

	txp::unordered_map<int, int>::iterator it = m1.find(1);
	cout << it->first << ":" << it->second << endl;
	m1[1] = 100;
	cout << it->first << ":" << it->second << endl;
	m1.erase(1);
	cout << it->first << ":" << it->second << endl;

	/*txp::unordered_map<int, int>::const_iterator it1 = m1.begin();
	while (it1 != m1.end())
	{
		cout << it1->first << ":" << it1->second << endl;
		++it1;
	}*/
	cout << endl;
}

void test2()
{
	txp::unordered_set<int> s1;
	s1.insert(1);
	s1.insert(22);
	s1.insert(35);
	s1.insert(42);
	s1.insert(100);

	txp::unordered_set<int>::iterator it = s1.find(22);
	cout << *it << endl;
	
	txp::unordered_set<int>::const_iterator it1 = s1.begin();
	while (it1 != s1.end())
	{
		cout << *it1 << endl;
		++it1;
	}
	cout << endl;

	s1.erase(22);

	it1 = s1.begin();
	while (it1 != s1.end())
	{
		cout << *it1 << endl;
		++it1;
	}
	cout << endl;
}

int main()
{
	test1();
	test2();

	return 0;
}